package Tests;

import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import ModelLayer.RealException;
import ModelLayer.SaleItem;
import ModelLayer.SaleItemRecords;
import ModelLayer.SalesLine;

public class SalesLineTest {
	
	private SalesLine salesline;
	private SaleItem saleItem1;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		
	}
	
	@Before
	public void setUp() throws Exception {
		
		saleItem1 = new SaleItem();
		saleItem1.setsPrice(20);
		saleItem1.setBarcode("111111111111");
		saleItem1.setTax(25);
		SaleItemRecords.getInstance().getSaleItemRecords().add(saleItem1);
		salesline = new SalesLine(null, 100, "111111111111");
		salesline.setProduct(saleItem1);
		
	}
	
	@Test
	public void testGetQuantity() throws RealException {
		Assert.assertEquals(100, salesline.getQuantity());
		Assert.assertNotSame(20, salesline.getQuantity());
	}
	
	@Test
	public void testGetProduct() {
		Assert.assertEquals(saleItem1, salesline.getSaleItem());
	}
	
	@Test
	public void testGetBarcode() {
		Assert.assertEquals("111111111111", salesline.getBarcode());
	}


}
